﻿using Microsoft.EntityFrameworkCore;
using Microsoft.EntityFrameworkCore.Metadata.Builders;

namespace EMall.IdentityService.PermissionGrants
{
    public class PermissionGrantEntityTypeConfiguration : IEntityTypeConfiguration<PermissionGrant>
    {
        public void Configure(EntityTypeBuilder<PermissionGrant> builder)
        {
            builder.ToTable("PermissionGrants");
            builder.Ignore(p => p.DomainEvents);
            builder.HasKey(p => p.Id);
            builder.Property(p => p.Permission).IsRequired();
            builder.Property(p => p.Type).IsRequired();
            builder.Property(p => p.Key).IsRequired();
        }
    }
}
